{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import json\n",
    "\n",
    "from gluonts.dataset.repository.datasets import get_dataset\n",
    "from gluonts.evaluation import Evaluator\n",
    "from gluonts.evaluation.backtest import make_evaluation_predictions\n",
    "\n",
    "from pts.model.deepar import DeepAREstimator\n",
    "from pts.modules.distribution_output import ImplicitQuantileOutput\n",
    "from pts import Trainer\n",
    "from pts.dataset.repository.datasets import dataset_recipes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "dataset = get_dataset(\"m5\", regenerate=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Recommended prediction horizon: 28\n",
      "Frequency of the time series: D\n"
     ]
    }
   ],
   "source": [
    "print(f\"Recommended prediction horizon: {dataset.metadata.prediction_length}\")\n",
    "print(f\"Frequency of the time series: {dataset.metadata.freq}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "estimator = DeepAREstimator(\n",
    "    distr_output=ImplicitQuantileOutput(output_domain=\"Positive\"),\n",
    "    cell_type='GRU',\n",
    "    input_size=63,\n",
    "    num_cells=64,\n",
    "    num_layers=3,\n",
    "    dropout_rate=0.2,\n",
    "    use_feat_dynamic_real=True,\n",
    "    use_feat_static_cat=True,\n",
    "    cardinality=[int(cat_feat_info.cardinality) for cat_feat_info in dataset.metadata.feat_static_cat],\n",
    "    embedding_dimension = [4, 4, 4, 4, 16],\n",
    "    prediction_length=dataset.metadata.prediction_length,\n",
    "    context_length=dataset.metadata.prediction_length*2,\n",
    "    freq=dataset.metadata.freq,\n",
    "    scaling=True,\n",
    "    trainer=Trainer(device=device,\n",
    "                    epochs=20,\n",
    "                    learning_rate=1e-3,\n",
    "                    num_batches_per_epoch=120,\n",
    "                    batch_size=256,\n",
    "                   )\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "255it [00:12, 20.38it/s]\n",
      "0it [00:00, ?it/s]/usr/local/anaconda3/lib/python3.8/site-packages/torch/distributions/distribution.py:44: UserWarning: <class 'pts.distributions.implicit_quantile.ImplicitQuantile'> does not define `arg_constraints`. Please set `arg_constraints = {}` or initialize the distribution with `validate_args=False` to turn off validation.\n",
      "  warnings.warn(f'{self.__class__} does not define `arg_constraints`. ' +\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.499, epoch=0]\n",
      "255it [00:12, 20.62it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.373, epoch=1]\n",
      "255it [00:12, 20.47it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.356, epoch=2]\n",
      "255it [00:12, 20.37it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.349, epoch=3]\n",
      "255it [00:12, 20.32it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.344, epoch=4]\n",
      "255it [00:12, 20.27it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.342, epoch=5]\n",
      "255it [00:12, 20.35it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.34, epoch=6]\n",
      "255it [00:12, 20.70it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.339, epoch=7]\n",
      "255it [00:12, 20.40it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.337, epoch=8]\n",
      "255it [00:12, 20.06it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.337, epoch=9]\n",
      "255it [00:12, 20.59it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.335, epoch=10]\n",
      "255it [00:12, 20.42it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.335, epoch=11]\n",
      "255it [00:12, 20.52it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.334, epoch=12]\n",
      "255it [00:12, 20.46it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.333, epoch=13]\n",
      "255it [00:12, 20.21it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.332, epoch=14]\n",
      "255it [00:12, 20.65it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.332, epoch=15]\n",
      "255it [00:12, 20.22it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.331, epoch=16]\n",
      "255it [00:12, 20.36it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.331, epoch=17]\n",
      "255it [00:12, 20.66it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.331, epoch=18]\n",
      "255it [00:12, 20.24it/s]\n",
      "0it [00:03, ?it/s, avg_epoch_loss=0.33, epoch=19]\n"
     ]
    }
   ],
   "source": [
    "predictor = estimator.train(dataset.train, num_workers=8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "forecast_it, ts_it = make_evaluation_predictions(\n",
    "    dataset=dataset.test,  # test dataset\n",
    "    predictor=predictor,  # predictor\n",
    "    num_samples=100,  # number of sample paths we want for evaluation\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "forecasts = list(forecast_it)\n",
    "tss = list(ts_it)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Running evaluation: 100%|██████████| 30490/30490 [00:01<00:00, 27259.18it/s]\n",
      "/home/krasul/.env/pytorch/lib/python3.8/site-packages/pandas/core/dtypes/cast.py:1672: UserWarning: Warning: converting a masked element to nan.\n",
      "  subarr = np.array(values, dtype=dtype, copy=copy)\n"
     ]
    }
   ],
   "source": [
    "evaluator = Evaluator()\n",
    "agg_metrics, item_metrics = evaluator(iter(tss), iter(forecasts), num_series=len(dataset.test))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"MSE\": 4.755984111358613,\n",
      "    \"abs_error\": 834177.9219083469,\n",
      "    \"abs_target_sum\": 1231764.0,\n",
      "    \"abs_target_mean\": 1.4428196598416543,\n",
      "    \"seasonal_error\": 1.12721783493784,\n",
      "    \"MASE\": 0.8981968607451877,\n",
      "    \"MAPE\": 0.8099336448562378,\n",
      "    \"sMAPE\": 1.6020707415533486,\n",
      "    \"OWA\": NaN,\n",
      "    \"MSIS\": 8.260408136542406,\n",
      "    \"QuantileLoss[0.1]\": 232933.92667773535,\n",
      "    \"Coverage[0.1]\": 0.5482148713864025,\n",
      "    \"QuantileLoss[0.2]\": 432863.72900996683,\n",
      "    \"Coverage[0.2]\": 0.5567293726280275,\n",
      "    \"QuantileLoss[0.3]\": 602256.93819869,\n",
      "    \"Coverage[0.3]\": 0.5704551843695826,\n",
      "    \"QuantileLoss[0.4]\": 737814.7064298784,\n",
      "    \"Coverage[0.4]\": 0.5920418872698383,\n",
      "    \"QuantileLoss[0.5]\": 834177.922027275,\n",
      "    \"Coverage[0.5]\": 0.6226373986787334,\n",
      "    \"QuantileLoss[0.6]\": 884780.6868602519,\n",
      "    \"Coverage[0.6]\": 0.6591399990629399,\n",
      "    \"QuantileLoss[0.7]\": 876329.6622192905,\n",
      "    \"Coverage[0.7]\": 0.7127079136016631,\n",
      "    \"QuantileLoss[0.8]\": 791094.1399574431,\n",
      "    \"Coverage[0.8]\": 0.7817387433819231,\n",
      "    \"QuantileLoss[0.9]\": 586032.7896624055,\n",
      "    \"Coverage[0.9]\": 0.8721290352809268,\n",
      "    \"RMSE\": 2.1808218889580626,\n",
      "    \"NRMSE\": 1.5114999813610817,\n",
      "    \"ND\": 0.677222196710041,\n",
      "    \"wQuantileLoss[0.1]\": 0.18910597052498315,\n",
      "    \"wQuantileLoss[0.2]\": 0.35141774642704837,\n",
      "    \"wQuantileLoss[0.3]\": 0.4889385776810249,\n",
      "    \"wQuantileLoss[0.4]\": 0.5989903150521353,\n",
      "    \"wQuantileLoss[0.5]\": 0.677222196806592,\n",
      "    \"wQuantileLoss[0.6]\": 0.7183037390768459,\n",
      "    \"wQuantileLoss[0.7]\": 0.711442826888341,\n",
      "    \"wQuantileLoss[0.8]\": 0.6422448942796211,\n",
      "    \"wQuantileLoss[0.9]\": 0.4757671028398342,\n",
      "    \"mean_absolute_QuantileLoss\": 664253.8334492152,\n",
      "    \"mean_wQuantileLoss\": 0.5392703743973806,\n",
      "    \"MAE_Coverage\": 0.16756209425937085\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(agg_metrics, indent=4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEGCAYAAABo25JHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAf70lEQVR4nO3dfZQU9Z3v8fe354kJg4JgRgQSTCC4iIoOJ2pwPYzEvSYa9KxcToxJSNYc9t5N9uZZ8eZp3ezZ60M2TxtvEq+a4F3jmGAMLCF6XRxi4hqihAcBH0BFGRJBySAMwsBMf+8fVYM9Q/f0TE1XdzH1eZ3TZ6qqu6o+89Tfrl/V71fm7oiISHplKh1AREQqS4VARCTlVAhERFJO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uN7j7RHefTPA39Yi7X5OEbGY20sxG9UwTtHVvIgG/U3d/BdhhZtPCRXOBLUnI1sfVvNks1JOj0vleBs43s7eE/7c9P7vS/c2V4+RLpR4EZ/afI2hf/lIF9n8vQZveEYJPRNcStNWtArYC/wGcFL7WgNvCrE8Bs2LOdiHBYe5GYH34eH8S8gFnAevCbJuAr4bL3wH8HthGcOheFy4fEc5vC59/R5l+v3N486qhimcLM2wIH5t7/uaT8DsN9zcTeDL8vf4CGJOUbOE+RxJ8cj4xZ1ki8gE3As+E/w//F6gr5d+chpgQEUm54dw0JCIiA6BCICKScioEIiIpp0IgIpJyKgQiIimnQiDSh5m5mf1bzny1mb1qb4402mhmKywYHXWLma0Ml0+2cKTZ8JrveywYCXSTmf027MUtkjjVxV8ikjoHgBlmVu/uBwk6tOX2Gv1H4GF3/w6AmZ2VZxufBna5+5nha6YR9CcRSRwdEYjktxK4LJzu29t0PEEHQQDcfWOe9ceTUzzc/Vl374whp8iQqRCI5NcCfNDMRhD0dF6T89xtwJ0W3NjnS2Z2ap717wKuN7PHzeyfzGxqGTKLRKJCIJJH+Cl/MsHRwMo+zz1E0L3//xCMirrOzE7u85r14WtuJRhH/gkz+4vYg4tEoHMEIoUtJxgHfg59xnN39z8T3KHsJ+FJ5IsIxojPfU0HwUiRPzezLMFYTk/HH1tkcHREIFLYXcCN7v5U7kIzu9jM3hJOjwLeSTBCZO5rZtub97etJbgN6EtlSS0ySDoiECnA3duA7+Z5qgn4npl1EXyYusPdn+hzk/B3At8Phw3OAL8kuPeDSOJo9FERkZRT05CISMqpEIiIpJwKgYhIyqkQiIiknAqBiEjKqRCIiKScCoGISMr9f/5GIprVVMwRAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "item_metrics.plot(x='MSIS', y='MASE', kind='scatter')\n",
    "plt.grid(which=\"both\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
